package il.ac.tau.cg.ex3.entities.surfaces;

import il.ac.tau.cg.ex3.entities.Entity;
import il.ac.tau.cg.ex3.entities.styles.Material;
import il.ac.tau.cg.ex3.math.Point;
import il.ac.tau.cg.ex3.math.Vector;
import il.ac.tau.cg.ex3.math.shapes.Bounded;
import il.ac.tau.cg.ex3.math.shapes.Intersectable;
import il.ac.tau.cg.ex3.math.shapes.Shape;
import il.ac.tau.cg.ex3.utils.Typed;
import il.ac.tau.cg.ex3.utils.octree.BoundingBox;

import java.util.SortedSet;

public abstract class Surface implements Typed, Entity, Bounded, Intersectable
{
	private Material material;
	
	public Surface(Material material)
	{
		this.material = material;
	}
	
	public void setMaterial(Material material)
	{
		this.material = material;
	}
	
	public Material getMaterial()
	{
		return material;
	}
	
	@Override
	public BoundingBox getBoundingBox()
	{
		return getShape().getBoundingBox();
	}
	
	@Override
	public SortedSet<Double> intersect(Point origin, Vector direction)
	{
		return getShape().intersect(origin, direction);
	}
	
	@Override
	public abstract int getType();
	public abstract Shape getShape();
}
